package cn.bug.greenflag.security;

/**
 * @program: qian_mianq
 * @description: security登录对象
 * @author: 岳瀚
 * @create: 2022-09-21 20:52
 **/
/*@Slf4j
@Service
public class UserDetailsServiceImpl implements UserDetailsService {
    @Autowired
    AdminMapper adminMapper;
    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        log.debug("自动调用UserDetailsServiceImpl方法,查询名为{}的对象",username);
        AdminLoginInfoVO adminLoginInfoVO = adminMapper.getLoginInfoByName(username);
        if (adminLoginInfoVO == null) {
            throw new BadCredentialsException("用户名或密码错误");
        }
        UserDetails userDetails = User.builder()
                .username(adminLoginInfoVO.getName())
                .password(adminLoginInfoVO.getPassword())
                .accountExpired(false)//用户是否过期
                .accountLocked(false)//是否锁定
                .credentialsExpired(false)//凭证是否过期
                .disabled(adminLoginInfoVO.getEnable()==0)//账号是否被禁用
                .authorities("写累了,明天写")
                .build();
        log.debug("向框架Security返回UserDetails对象{}",userDetails);
        return userDetails;
    }
}*/
